﻿// Decompiled with JetBrains decompiler
// Type: Bannerlord.BUTR.Shared.Utils.WrappedMethodInfo
// Assembly: MCMv5, Version=5.10.2.0, Culture=neutral, PublicKeyToken=null
// MVID: 7AB326B9-B2B4-41C2-9177-68E944071101
// Assembly location: D:\steam\steamapps\workshop\content\261550\2859238197\bin\Win64_Shipping_Client\MCMv5.dll

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Reflection;

#nullable enable
namespace Bannerlord.BUTR.Shared.Utils
{
  internal sealed class WrappedMethodInfo : MethodInfo
  {
    private readonly object _instance;
    private readonly MethodInfo _methodInfoImplementation;

    public WrappedMethodInfo(MethodInfo actualMethodInfo, object instance)
    {
      this._methodInfoImplementation = actualMethodInfo;
      this._instance = instance;
    }

    public override MethodAttributes Attributes => this._methodInfoImplementation.Attributes;

    public override CallingConventions CallingConvention
    {
      get => this._methodInfoImplementation.CallingConvention;
    }

    public override bool ContainsGenericParameters
    {
      get => this._methodInfoImplementation.ContainsGenericParameters;
    }

    public override IEnumerable<CustomAttributeData> CustomAttributes
    {
      get => this._methodInfoImplementation.CustomAttributes;
    }

    public override Type? DeclaringType => this._methodInfoImplementation.DeclaringType;

    public override bool IsGenericMethod => this._methodInfoImplementation.IsGenericMethod;

    public override bool IsGenericMethodDefinition
    {
      get => this._methodInfoImplementation.IsGenericMethodDefinition;
    }

    public override bool IsSecurityCritical => this._methodInfoImplementation.IsSecurityCritical;

    public override bool IsSecuritySafeCritical
    {
      get => this._methodInfoImplementation.IsSecuritySafeCritical;
    }

    public override bool IsSecurityTransparent
    {
      get => this._methodInfoImplementation.IsSecurityTransparent;
    }

    public override MemberTypes MemberType => this._methodInfoImplementation.MemberType;

    public override int MetadataToken => this._methodInfoImplementation.MetadataToken;

    public override RuntimeMethodHandle MethodHandle => this._methodInfoImplementation.MethodHandle;

    public override MethodImplAttributes MethodImplementationFlags
    {
      get => this._methodInfoImplementation.MethodImplementationFlags;
    }

    public override Module Module => this._methodInfoImplementation.Module;

    public override string Name => this._methodInfoImplementation.Name;

    public override Type? ReflectedType => this._methodInfoImplementation.ReflectedType;

    public override ParameterInfo ReturnParameter => this._methodInfoImplementation.ReturnParameter;

    public override Type ReturnType => this._methodInfoImplementation.ReturnType;

    public override ICustomAttributeProvider ReturnTypeCustomAttributes
    {
      get => this._methodInfoImplementation.ReturnTypeCustomAttributes;
    }

    public override Delegate CreateDelegate(Type delegateType)
    {
      return this._methodInfoImplementation.CreateDelegate(delegateType);
    }

    public override Delegate CreateDelegate(Type delegateType, object? target)
    {
      return this._methodInfoImplementation.CreateDelegate(delegateType, target);
    }

    public override MethodInfo GetBaseDefinition()
    {
      return this._methodInfoImplementation.GetBaseDefinition();
    }

    public override object[] GetCustomAttributes(bool inherit)
    {
      return this._methodInfoImplementation.GetCustomAttributes(inherit);
    }

    public override object[] GetCustomAttributes(Type attributeType, bool inherit)
    {
      return this._methodInfoImplementation.GetCustomAttributes(attributeType, inherit);
    }

    public override IList<CustomAttributeData> GetCustomAttributesData()
    {
      return this._methodInfoImplementation.GetCustomAttributesData();
    }

    public override Type[] GetGenericArguments()
    {
      return this._methodInfoImplementation.GetGenericArguments();
    }

    public override MethodInfo GetGenericMethodDefinition()
    {
      return this._methodInfoImplementation.GetGenericMethodDefinition();
    }

    public override MethodBody? GetMethodBody() => this._methodInfoImplementation.GetMethodBody();

    public override MethodImplAttributes GetMethodImplementationFlags()
    {
      return this._methodInfoImplementation.GetMethodImplementationFlags();
    }

    public override ParameterInfo[] GetParameters()
    {
      return this._methodInfoImplementation.GetParameters();
    }

    public override object? Invoke(
      object? obj,
      BindingFlags invokeAttr,
      Binder? binder,
      object?[]? parameters,
      CultureInfo? culture)
    {
      return this._methodInfoImplementation.Invoke(this._instance, invokeAttr, binder, parameters, culture);
    }

    public override bool IsDefined(Type attributeType, bool inherit)
    {
      return this._methodInfoImplementation.IsDefined(attributeType, inherit);
    }

    public override MethodInfo MakeGenericMethod(params Type[] typeArguments)
    {
      return this._methodInfoImplementation.MakeGenericMethod(typeArguments);
    }

    public override string? ToString() => this._methodInfoImplementation.ToString();

    public override bool Equals(object? obj)
    {
      if (true)
        ;
      bool flag;
      if (!(obj is WrappedMethodInfo wrappedMethodInfo))
      {
        MethodInfo methodInfo = obj as MethodInfo;
        flag = (object) methodInfo != null ? this._methodInfoImplementation.Equals((object) methodInfo) : this._methodInfoImplementation.Equals(obj);
      }
      else
        flag = this._methodInfoImplementation.Equals((object) wrappedMethodInfo._methodInfoImplementation);
      if (true)
        ;
      return flag;
    }

    public override int GetHashCode() => this._methodInfoImplementation.GetHashCode();
  }
}
